package com.jdone.compus.controller;

import com.jdone.compus.dto.ApiResponse;
import com.jdone.compus.service.OrderReconciliationService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/internal/reconcile")
public class ReconciliationController {

    private final OrderReconciliationService reconciliationService;

    public ReconciliationController(OrderReconciliationService reconciliationService) {
        this.reconciliationService = reconciliationService;
    }

    /**
     * POST /internal/reconcile/orders
     * body or params: startTime, endTime, pageSize (可选)
     */
    @PostMapping("/orders")
    public ApiResponse reconcile(@RequestParam String startTime,
                                 @RequestParam String endTime,
                                 @RequestParam(required = false) Integer pageSize,
                                 @RequestParam Boolean isUpload) {
        return reconciliationService.reconcileAndSync(startTime, endTime, pageSize, isUpload);
    }
}
